import axios from 'axios'


//全局设置
const service = axios.create({
  baseURL: "http://localhost:8080", 
  timeout: 5000 
})

// 请求拦截器
service.interceptors.request.use(
  config => {
    config.headers.token = localStorage.getItem("token");
    return config
  }
)

//响应拦截器
service.interceptors.response.use(
  response => {
    const res = response.data

    return res;
  }
)

export default service
